﻿<%@ Page Language="C#" AutoEventWireup="true" Inherits="website_admin_bbs_topiclist" Codebehind="topiclist.aspx.cs" %>

<%@ Register Src="~/admin/_root/_controls/ctlNavBar.ascx" TagName="ctlNavBar" TagPrefix="uc1" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
    <title>主题管理</title>

    <script language="javascript" src="../../_common/scripts/jquery-1.4.1.min.js" type="text/javascript"></script>
 
    <script type="text/javascript" language="javascript" src="../../_common/scripts/jquery_stringutil.js"></script>
    <script type="text/javascript" language="javascript" src="../../_common/scripts/util.js"></script>

    <link href="../../_common/styles/form_2_0.css" rel="stylesheet" type="text/css" />
    <link href="../../_common/flexigrid/flexigrid_blue.css" rel="stylesheet" type="text/css" />

    <script language="javascript" type="text/javascript">
        var pre_scrollLeft=0;
        $(document).ready(setup);
        function setup()
        {
            LoadingData();
        }
        /// 自动校对左右滚动条
        $(window).resize(function(){
            if(document.getElementById("scrool_left"))
            {
	            if(pre_scrollLeft != document.getElementById("scrool_left").scrollLeft){
                    pre_scrollLeft=document.getElementById("scrool_left").scrollLeft; 
                    $(".hDivBox").css("margin-left", -pre_scrollLeft);
                }
            }
        });

        function ItemSelected(_obj)
        {
            var _itemsId = document.getElementById("txtItemsId");

            if (_obj.checked) {
                if (_itemsId.value.indexOf(_obj.oid) == -1) {
                    _itemsId.value += _obj.oid + ",";
                } 
                $("#"+_obj.id).parent().parent().parent().addClass("trSelected");
            }
            else {
                _itemsId.value = _itemsId.value.replace(_obj.oid + ",", "");
                $("#"+_obj.id).parent().parent().parent().removeClass("trSelected"); 
            }
        }
        function SelectedAllItems()
        {
            var _itemsId = document.getElementById("txtItemsId");

            $("input[name='cbxItems']").each(function() {
                if (!$(this).attr("disabled")) { 
                    _objectid = $(this).attr("oid");

                    if (!$(this).attr("checked")) {
                        $(this).attr("checked", true);

                        /// 加入队列
                        if (_itemsId.value.indexOf("'" + _objectid + "'") == -1) {
                            _itemsId.value += _objectid + ",";
                        } 
                        $(this).parent().parent().parent().addClass("trSelected");
                    }
                    else {
                        $(this).attr("checked", false);
                        _itemsId.value = _itemsId.value.replace(_objectid + ",", "");
                        $(this).parent().parent().parent().removeClass("trSelected"); 
                    }
                }
            });
        } 
    	
        function DeleteItems(_obj) { 
            if(confirm("你确定要删除所选记录吗?"))
            {
                var _itemsId = document.getElementById("txtItemsId").value;
                if(_itemsId != "")
                {
                    _itemsId += "|";
                    _itemsId = _itemsId.replace(",|", "");
                    
                    $.ajax({
                        async: false,
                        type: "POST",
                        url: "topiclist.aspx",
                        data: {
                            otype: "deleteitems",
                            itemsid: _itemsId
                        },
                        success: function(data, textStatus) { 
                            if (data == "succeeded") { 
                                alert("删除成功!");
                                $("#txtItemsId").val("");
                                LoadingData();
                            }
                            else {
                                alert(data);
                                LoadingData();
                            }
                        }
                    });
                }
                else
                    alert("请先选中需要删除的记录！");
            }
        } 
        function ApproveItems(typecode) { 
            if(confirm("你确定要审核发布所选记录吗?"))
            {
                var _itemsId = document.getElementById("txtItemsId").value;
                if(_itemsId != "")
                {
                    _itemsId += "|";
                    _itemsId = _itemsId.replace(",|", "");
                    
                    $.ajax({
                        async: false,
                        type: "POST",
                        url: "topiclist.aspx",
                        data: {
                            otype: "approveitems",
                            typecode:  typecode,
                            itemsid: _itemsId
                        },
                        success: function(data, textStatus) { 
                            if (data == "succeeded") { 
                                alert("操作成功!");
                                $("#txtItemsId").val("");
                                LoadingData();
                            }
                            else {
                                alert(data);
                                LoadingData();
                            }
                        }
                    });
                }
                else
                    alert("请先选中需要删除的记录！");
            }
        } 
        var pageIndex = "1";
        var pageSize = 50;
        /// 分页
        function pagination(index)
        {
            pageIndex = index;
            LoadingData();
        }
        /// 查询
        function Search()
        {
            pageIndex = 1;
            LoadingData();
        }
        /// 每页显示记录数设定
        function ChangePagesize(rp)
        {
            pageSize = rp.value;
            LoadingData();
        }
        function LoadingData() {
            $.ajax({
                async: true,
                type: "POST",
                url: "topiclist.aspx",
                data: {
                    index: pageIndex,
                    pagesize: pageSize,
                    otype       :  "loadingdata",
                    columnid    : $("#selColumns").val(),
                    statuscode  :   $("#selStatusCode").val(),
                    keys        :   $("#txtKeys").val() 
                },
                beforeSend: function() {
                    $("#divItemsList").html("<div class=\"tDiv\"></div>" + $("#divTreeLoading").html() + "<div class=\"pDiv\"></div>");
                },
                success: function(data, textStatus) { 
                    $("#divItemsList").html("");
                    $("#divItemsList").html(data);
                }
            });
        }
        function OpenDia(objectid) {
            window.location.href=prependOrgName("/website_admin/bbs/topic_replies.aspx?otype=modify&tid="+objectid+"&groupid="+getUrlParam("groupid"));
        }
    </script>

</head>
<body scrool="no" style="margin: 0px; padding: 0px;">
    <div id="divTreeLoading" style="display: none;">
        <div class="bDiv" style="height: 320px;">
            <div style="background-color: #FFFFFF; table-layout: fixed; width: auto; height: 100%;
                text-align: center; margin-top: 30px;">
                <img border="0" src="../_imgs/admin/progress.gif" />
                <span style="line-height: 42px;">Loading ... </span>
            </div>
        </div>
    </div>
    <form id="form1" runat="server">
        <input name="txtCreatedBy" type="hidden" id="txtCreatedBy" runat="server" />
        <input name="txtItemsId" type="hidden" id="txtItemsId" />
        <div class="divAreas">
            <div class="boxTopBar_1">
                <div class="navBar">
                    <uc1:ctlNavBar ID="CtlNavBar1" runat="server" />
                </div>
            </div>
            <table cellpadding="0" cellspacing="0" class="stdTable" style="width: 100%;">
                <tbody>

                    <tr>
                        <td valign="top" style="padding: 8px 5px 0px;">
                            <table class="stdTable" cellpadding="2" cellspacing="2">
                                <colgroup>
                                    <col style="width: 70px;" />
                                    <col style="width: 180px;" />  
                                    <col style="width: 80px;" />
                                    <col style="width: 150px;" />
                                    <col style="width: 80px;" />
                                    <col style="width: 120px;" />
                                    <col />
                                </colgroup>
                                <tr> 
                                    <td>
                                        <label for="txtKeys">
                                            <b>关键字：</b></label>
                                    </td>
                                    <td>
                                        <input type="text" id="txtKeys" class="textbox" runat="server" style="width: 95%;" />
                                    </td>
                                    <td>
                                        <label for="txtKeys">
                                            <b>分类：</b></label>
                                    </td>
                                    <td>
                                        <select id="selColumns" runat="server" style="width: 95%" class="SelectBox">
                                            <option value="">-- 请选择 --</option> 
                                        </select>
                                    </td>
                                    <td>
                                        <label for="txtKeys">
                                            <b>状态：</b></label>
                                    </td>
                                    <td>
                                        <select id="selStatusCode" runat="server" style="width: 95%" class="SelectBox">
                                            <option value="">-- 全部 --</option>
                                            <option value="0">未审核</option>
                                            <option value="1">已审核</option>
                                        </select>
                                    </td>
                                    <td style="padding-left: 5px;">
                                        <input id="btnFind" class="btn_s" value="查 询" type="button" onclick="Search();" />
                                    </td>
                                </tr>
                            </table>
                        </td>
                    </tr>
                    <tr style="height: 100%;">
                        <td valign="top" style="padding: 5px 5px 0px;">
                            <div class="flexigrid" id="divItemsList">
                            </div>
                        </td>
                    </tr>
                </tbody>
            </table>
        </div>
    </form>
</body>
</html>
